/*
 * Banbu_NopushView
 * @description 本文件提供附近的人界面上方提示界面（NoticeOpenTypePush等）
 * @package
 * @author 		***
 * @copyright
 * @version 		1.0
 * @description 本文件提供附近的人界面上方提示界面（NoticeOpenTypePush等）
 */

#import "Banbu_NopushView.h"

@implementation Banbu_NopushView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        self.backgroundColor = UIColorWithRGB(124, 132, 132, 1.0);
        _subtitleLabel.textColor = UIColorWithRGB(124, 132, 132, 1.0);
        _titleLabel.textColor = UIColorWithRGB(124, 132, 132, 1.0);
    }
    return self;
}
+ (id)shareView
{
//    return [[[NSBundle mainBundle] loadNibNamed:@"Banbu_NopushView" owner:nil options:nil] objectAtIndex:0];
    Banbu_NopushView * pushV = [[[NSBundle mainBundle] loadNibNamed:@"Banbu_NopushView" owner:nil options:nil] objectAtIndex:0];
    pushV.backgroundColor = UIColorToRGB(0xf6f6f6);
    pushV.subtitleLabel.textColor = UIColorWithRGB(124, 132, 132, 1.0);
    pushV.titleLabel.textColor = UIColorWithRGB(124, 132, 132, 1.0);
    return pushV;
    
}


-(void)setNoticeType:(NoticeOpenType)_type
{
    switch (_type) {
        case NoticeOpenTypeLocation:
        {
            self.titleLabel.text = NSLocalizedString(@"openLocationTitle", 您没有开启地理定位服务);
            self.subtitleLabel.text =NSLocalizedString(@"openLocationSubtitle", 开启后才有更多附近好友和您交友);
//            [_gobtn setTitle:NSLocalizedString(@"looklook", nil) forState:UIControlStateNormal];
        }
            
            break;
        case NoticeOpenTypePush:
        {
            self.titleLabel.text = NSLocalizedString(@"openPushTitle", 您没有开启推送服务);
            self.subtitleLabel.text = NSLocalizedString(@"openPushSubtitle", 开启后以免遗漏您的好友信息);
//            [_gobtn setTitle:NSLocalizedString(@"looklook", nil) forState:UIControlStateNormal];
        }
            break;
        case NoticeOpenTypeImproveProfile:
        {
            self.titleLabel.text = NSLocalizedString(@"improveProfileTitle", 完善您的个人资料);
            self.subtitleLabel.text = NSLocalizedString(@"improveProfileSubtitle", nil);
//            [_gobtn setTitle:NSLocalizedString(@"improveProfile", nil) forState:UIControlStateNormal];

        }
        case NoticeOpenTypeNetwork:
        {
            self.titleLabel.text = NSLocalizedString(@"network_unavailabel", 当前网络不可用请检查);
            self.subtitleLabel.text = NSLocalizedString(@"network_unavailabelSubtitle", nil);
//            [_gobtn setTitle:NSLocalizedString(@"looklook", nil) forState:UIControlStateNormal];
        }
            break;
        case NoticeOpenTypeInviteFriend:
        {
            self.titleLabel.text = MyLocal(@"yaoqingFriend",邀请好友);
            self.subtitleLabel.text = MyLocal(@"inviteMoreFriend",邀请更多好友);
//            [_gobtn setTitle:NSLocalizedString(@"invite", nil) forState:UIControlStateNormal];

        }
            //2014年11月17日13:01:19 by yinlinlin 打招呼界面使用
        case NoticeOpenTypeSayHi:
        {
            self.titleLabel.text = NSLocalizedString(@"SayHi_first", nil);
            self.subtitleLabel.text = NSLocalizedString(@"SayHi_detail", nil);
        }
            break;
        default:
            break;
    }
}
//邀请好友
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/
- (IBAction)openpush:(id)sender
{
//    [UIView animateWithDuration:1 animations:^{
//        self.frame = CGRectMake(320, 0, 320, 50);
//    } completion:^(BOOL finished) {
    
        if(self.open)
        {
            _open(sender);
        }
//    [self removeFromSuperview];
//    }];
}
- (IBAction)dismissview:(id)sender
{
    [UIView animateWithDuration:1 animations:^{
        self.alpha = 0;
        self.frame = CGRectMake(320, 0, 320, 50);
    } completion:^(BOOL finished) {
        [self removeFromSuperview];
        if(self.dismiss)
        {
            _dismiss(sender);
        }
    }];

}

- (void)dealloc {
    [_titleLabel release];
    [_subtitleLabel release];
    [_gobtn release];
    [super dealloc];
}
@end
